const path = require('path');
const fs = require('fs');
module.exports = {
    pluginOptions: {
        'style-resources-loader': {
            preProcessor: 'less',
            patterns: [
                // 全局less变量存储路径
                path.resolve(__dirname, './src/assets/css/init.less'),
            ],
        },
    },
    chainWebpack(config) {
        config.resolve.alias.set('@', path.resolve('src'));
        config.module
            .rule('mjs')
            .test(/\.mjs$/)
            .include.add(
                path.resolve(__dirname, 'node_modules/@web-tracing/vue3')
            )
            .end()
            .type('javascript/auto')
            .use('babel-loader')
            .loader('babel-loader')
            .options({
                presets: ['@babel/preset-env'],
            });
        config.plugin('define').tap((definitions) => {
            Object.assign(definitions[0], {
                __VUE_OPTIONS_API__: 'true',
                __VUE_PROD_DEVTOOLS__: 'false',
                __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false',
            });
            return definitions;
        });
    },
    publicPath: '/',
    // devServer: {
    //     host: 'MeiFanNao',
    //     https: {
    //         cert: fs.readFileSync(path.join(__dirname, 'src/ssl/cert.crt')),
    //         key: fs.readFileSync(path.join(__dirname, 'src/ssl/cert.key')),
    //     },
    //     port: 443,
    //     disableHostCheck: true,
    // },
    configureWebpack: {
        devtool:"source map" 
    }
};
